home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / DShowIDL / medparam.idl < prev    next >
Text File  |  2001-10-08  |  10KB  |  229 lines

  1. //------------------------------------------------------------------------------
  2. // File: MedParam.idl
  3. //
  4. // Desc: Definition of the IMediaParams and associated interfaces. These
  5. //       interfaces are designed to allow communication of curve-following
  6. //       behaviors for parameters of objects which require dynamic changes
  7. //       to their parameters at run time.  All changes are specified by
  8. //       timestamp and curve type to ensure the parameters can be set
  9. //       at sufficient accuracy with predictable behavior on subsequent
  10. //       playback of the same curves.
  11. //
  12. // Copyright (c) 1999-2001, Microsoft Corporation.  All rights reserved.
  13. //------------------------------------------------------------------------------
  14.  
  15.  
  16. import "oaidl.idl";
  17. import "ocidl.idl";
  18. import "strmif.idl";
  19.  
  20.  
  21. //------------------------------------------------------------------------------
  22. // Define the semantic type to be used for each parameter.  All values passed
  23. // into this interface are 32-bit floats, but the interface can specify that
  24. // the values must be integer, booleans, or enumerated types
  25. //------------------------------------------------------------------------------
  26. typedef float MP_DATA;          // All data is 32-bit floats
  27.  
  28. typedef enum _MP_Type {
  29.    MPT_INT,                     // data is signed 23 bit integer (mantissa)
  30.    MPT_FLOAT,                   // data is 32bit IEEE float
  31.    MPT_BOOL,                    // data is true or false (using ANSI C++ definition)
  32.    MPT_ENUM,                    // data is a set (represented by consecutive integers)
  33.    MPT_MAX,
  34. } MP_TYPE;
  35.  
  36. const MP_DATA MPBOOL_TRUE = 1.0;    // Value of true
  37. const MP_DATA MPBOOL_FALSE = 0.0;   // Value of false
  38.  
  39.  
  40. //------------------------------------------------------------------------------
  41. // Define the types of curves which are supported
  42. //------------------------------------------------------------------------------
  43. typedef enum _MP_CURVE_TYPE {
  44.     MP_CURVE_JUMP      = 0x0001, // No interpolation, just jump to next point
  45.     MP_CURVE_LINEAR    = 0x0002, // Linear interpolation (y follows x from 0.0 to 1.0)
  46.     MP_CURVE_SQUARE    = 0x0004, // y follow x^2 from 0.0 to 1.0
  47.     MP_CURVE_INVSQUARE = 0x0008, // y follows 1-(x^2) from 0.0 to 1.0
  48.     MP_CURVE_SINE      = 0x0010, // y follows sin(x) from -pi/2 to pi/2
  49. } MP_CURVE_TYPE;
  50.  
  51.  
  52. //------------------------------------------------------------------------------
  53. // Capability bits. Used by the object to specify what capabilities it has.
  54. //------------------------------------------------------------------------------
  55. typedef DWORD MP_CAPS;
  56. // Curve capabilities - If the cap bit is set, that type of curve is supported
  57. const MP_CAPS MP_CAPS_CURVE_JUMP = MP_CURVE_JUMP;
  58. const MP_CAPS MP_CAPS_CURVE_LINEAR = MP_CURVE_LINEAR;
  59. const MP_CAPS MP_CAPS_CURVE_SQUARE = MP_CURVE_SQUARE;
  60. const MP_CAPS MP_CAPS_CURVE_INVSQUARE = MP_CURVE_INVSQUARE;
  61. const MP_CAPS MP_CAPS_CURVE_SINE = MP_CURVE_SINE;
  62.  
  63.  
  64. //------------------------------------------------------------------------------
  65. // Structure used to return information about the type and limits of a parameter
  66. //------------------------------------------------------------------------------
  67. typedef struct _MP_PARAMINFO {
  68.    MP_TYPE mpType;      // One of MP_TYPE_xxx codes
  69.    MP_CAPS  mopCaps;    // A collection of MP_CAPS flags
  70.  
  71.    // Minimum and maximum values
  72.    MP_DATA mpdMinValue;     // minimum legal value
  73.    MP_DATA mpdMaxValue;     // maximum legal value
  74.    MP_DATA mpdNeutralValue; // default or 'center' value
  75.  
  76.    // Defualt Unit and Label text. These strings will ALWAYS be English
  77.    // strings in the UNICODE character set. For international text
  78.    // use the GetParamText member function
  79.    WCHAR                   szUnitText[32];  // units of the parameter
  80.    WCHAR                   szLabel[32];     // name of the parameter
  81.  
  82. } MP_PARAMINFO;
  83.  
  84.  
  85. //------------------------------------------------------------------------------
  86. // Parameter Index types
  87. //------------------------------------------------------------------------------
  88. typedef DWORD DWORD;
  89. const DWORD DWORD_ALLPARAMS = -1;   // Apply this operation to all params
  90.  
  91.  
  92. //------------------------------------------------------------------------------
  93. // Defined list of timestamp types
  94. //------------------------------------------------------------------------------
  95. typedef DWORD MP_TIMEDATA;  // Extra data to further define type
  96.  
  97. // REFERENCE_TIME (1 tick = 100 nanoseconds, MP_TIMEDATA ignored)
  98. cpp_quote("DEFINE_GUID(GUID_TIME_REFERENCE,")
  99. cpp_quote("0x93ad712b, 0xdaa0, 0x4ffe, 0xbc, 0x81, 0xb0, 0xce, 0x50, 0xf, 0xcd, 0xd9);")
  100.  
  101. // Music Time (MP_TIMEDATA = parts/quarter note)
  102. cpp_quote("DEFINE_GUID(GUID_TIME_MUSIC,")
  103. cpp_quote("0x574c49d, 0x5b04, 0x4b15, 0xa5, 0x42, 0xae, 0x28, 0x20, 0x30, 0x11, 0x7b);")
  104.  
  105. // Time is measures in samples. MP_TIMEDATA = Samples/sec)
  106. cpp_quote("DEFINE_GUID(GUID_TIME_SAMPLES,")
  107. cpp_quote("0xa8593d05, 0xc43, 0x4984, 0x9a, 0x63, 0x97, 0xaf, 0x9e, 0x2, 0xc4, 0xc0);")
  108.  
  109.  
  110. //------------------------------------------------------------------------------
  111. // The value of a given parameter at a specific point in time
  112. //------------------------------------------------------------------------------
  113. typedef DWORD MP_FLAGS;
  114. const MP_FLAGS MPF_ENVLP_STANDARD         = 0x0000; // Use all data provided
  115. const MP_FLAGS MPF_ENVLP_BEGIN_CURRENTVAL = 0x0001;
  116.         // Ignore valStart value, use current value as the staring point
  117. const MP_FLAGS MPF_ENVLP_BEGIN_NEUTRALVAL = 0x0002;
  118.         // Ignore valStart value, use neutral value as the staring point
  119.  
  120. typedef struct _MP_ENVELOPE_SEGMENT {
  121.    REFERENCE_TIME  rtStart;     // Start time in current time format
  122.    REFERENCE_TIME  rtEnd;       // End time in current time format
  123.    MP_DATA         valStart;    // Initial Value
  124.    MP_DATA         valEnd;      // Final Value
  125.    MP_CURVE_TYPE   iCurve;      // One of MP_CURVE_TYPE codes
  126.    MP_FLAGS        flags;       // Special cases
  127. } MP_ENVELOPE_SEGMENT;
  128.  
  129. //------------------------------------------------------------------------------
  130. // Define flags for Punch-in timing
  131. //------------------------------------------------------------------------------
  132. const MP_FLAGS MPF_PUNCHIN_REFTIME = 0; // Use the reference time as the PI time
  133. const MP_FLAGS MPF_PUNCHIN_NOW = 0x0001; // Punch in at the current clock time
  134. const MP_FLAGS MPF_PUNCHIN_STOPPED = 0x0002; // Return change notifications during
  135.                                              // author time
  136.  
  137. //------------------------------------------------------------------------------
  138. // IMediaParamInfo - Interface used to determine the names, data types and
  139. // units of the parameters which are exposed by the object.  This interface
  140. // is used at discovery time, and is not required during run-time since the
  141. // objects parameters are a fixed set and this data can be cached by the
  142. // calling applicaiton.
  143. //------------------------------------------------------------------------------
  144. [
  145. object,
  146. uuid(6d6cbb60-a223-44aa-842f-a2f06750be6d),
  147. version(1.0)
  148. ]
  149. interface IMediaParamInfo : IUnknown
  150. {
  151.     HRESULT GetParamCount (
  152.         [out] DWORD * pdwParams
  153.     );
  154.     HRESULT GetParamInfo (
  155.         [in] DWORD dwParamIndex,
  156.         [out] MP_PARAMINFO * pInfo
  157.     );
  158.     // returns a series of null terminated strings. strings are in the
  159.     // following order:
  160.     // Param Label, Units Text, 1st Enum Text, 2nd Enum Text, etc...
  161.     HRESULT GetParamText (
  162.         [in] DWORD dwParamIndex,    // which param to get text for
  163.         [out] WCHAR **ppwchText     // returns ptr to CoTaskMemAlloc'd string
  164.     );
  165.  
  166.     // Returns the number of diffrent time formats this object understands
  167.     HRESULT GetNumTimeFormats (
  168.         [out] DWORD * pdwNumTimeFormats
  169.     );
  170.  
  171.     // Returns the GUID for the ith supported time format
  172.     HRESULT GetSupportedTimeFormat(
  173.         [in] DWORD dwFormatIndex,
  174.         [out] GUID *pguidTimeFormat
  175.     );
  176.  
  177.     // Returns the current time format
  178.     HRESULT GetCurrentTimeFormat (
  179.         [out] GUID *pguidTimeFormat,
  180.         [out] MP_TIMEDATA *pTimeData
  181.     );
  182. }
  183.  
  184. //------------------------------------------------------------------------------
  185. // IMediaParams - Interfaes used to actually set the media params and the
  186. // envelopes to follow
  187. //------------------------------------------------------------------------------
  188. [
  189. object,
  190. uuid(6d6cbb61-a223-44aa-842f-a2f06750be6e),
  191. version(1.0)
  192. ]
  193. interface IMediaParams : IUnknown
  194. {
  195.     // Single param Get/Set methods
  196.     HRESULT GetParam (
  197.         [in] DWORD dwParamIndex,
  198.         [out] MP_DATA *pValue
  199.     );
  200.     HRESULT SetParam (
  201.         [in] DWORD dwParamIndex,
  202.         [in] MP_DATA value
  203.     );
  204.  
  205.     // Envelope methods (param change over time)
  206.     HRESULT AddEnvelope (
  207.         [in] DWORD dwParamIndex,
  208.         [in] DWORD cSegments,
  209.         [in]  MP_ENVELOPE_SEGMENT * pEnvelopeSegments
  210.     );
  211.  
  212.     // Flush all of the envelope information for the given paramter between
  213.     // the timestamps specified
  214.     HRESULT FlushEnvelope (
  215.         [in] DWORD dwParamIndex,
  216.         [in] REFERENCE_TIME refTimeStart,
  217.         [in] REFERENCE_TIME refTimeEnd
  218.     );
  219.  
  220.     // Change the time format being used by the object
  221.     HRESULT SetTimeFormat (
  222.         [in] GUID guidTimeFormat,
  223.         [in] MP_TIMEDATA mpTimeData
  224.     );
  225. }
  226.  
  227.  
  228.  
  229.